package org.nepu.scr.indexrate.converter.riskrate.equipmentdata;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentdata.DrillingDeviceMenu2_4;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class DrillingDeviceMenuConverter2_4 implements AttributeConverter<DrillingDeviceMenu2_4, String> {
    @Override
    public String convertToDatabaseColumn(DrillingDeviceMenu2_4 drillingMachineMenu) {
        return JSONUtil.toJsonStr(drillingMachineMenu);
    }

    @Override
    public DrillingDeviceMenu2_4 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, DrillingDeviceMenu2_4.class);
    }
}
